<?php

namespace PhpBoot\Entity\Annotations;

use PhpBoot\Annotation\AnnotationBlock;
use PhpBoot\Annotation\AnnotationTag;
use PhpBoot\Entity\ContainerFactory;
use PhpBoot\Entity\EntityContainer;
use PhpBoot\Entity\EntityContainerBuilder;
use PhpBoot\Entity\MixedTypeContainer;
use PhpBoot\Exceptions\AnnotationSyntaxException;
use PhpBoot\Utils\AnnotationParams;
use PhpBoot\Utils\TypeHint;

class SubAnnotationHandler
{
    /**
     * @param EntityContainer $container
     * @param AnnotationBlock|AnnotationTag $ann
     * @param EntityContainerBuilder $builder
     * @return void
     */
    public function __invoke(EntityContainer $container, $ann, EntityContainerBuilder $builder)
    {
        $target = $ann->parent->name;
        $property = $container->getProperty($target);
        $property or \PhpBoot\abort($container->getClassName()." property $target not exist ");
        $property->isSub = true;
    }
}